package com.ruoyi.result;


import lombok.Data;

@Data
public class ResultView {

  private Integer code;

  private String msg;

  private Object data;

  public static ResultView ok() {
    return new ResultView();
  }

  public static ResultView ok(Object data) {
    return new ResultView(data);
  }

  public static ResultView error(ResultEnum resultEnum) {
    return new ResultView(resultEnum.getCode(), resultEnum.getMsg());
  }


  public static ResultView error(int code,String msg) {
    return new ResultView(code,msg);
  }

  private ResultView() {
    this.code = ResultEnum.CODE_200.getCode();
    this.msg = ResultEnum.CODE_200.getMsg();
  }

  private ResultView(Object data) {
    this.data = data;
    this.code = ResultEnum.CODE_200.getCode();
    this.msg = ResultEnum.CODE_200.getMsg();
//    this.time=System.currentTimeMillis();
  }

  private ResultView(Integer code, String msg) {
    this.code = code;
    this.msg = msg;
//    this.time=System.currentTimeMillis();
  }

}

